<%@page import="java.util.List"%>
<%@page import="entities.Category"%>
<%@page import="helpers.PaginatorHelper"%>
<%@page import="helpers.UrlHelper"%>
<%@page import="java.util.ArrayList"%>
<%
List<Category> categories = (List<Category>) request.getAttribute("categories");
%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<jsp:include page="/admin/layouts/header.jsp" />

<link rel="stylesheet" type="text/css" href="/admin/css/jquery.treeview.css" media="screen" />
<script type="text/javascript" src="/admin/js/jquery.treeview.js"></script>
<script type="text/javascript" src="/admin/js/custom/category_dir.js"></script>
		
				<script type="text/javascript" src="/admin/js/dashboard.js"></script><!-- Init plugins only for page -->
				
                <jsp:include page="/admin/elements/heading_panel.jsp" />

                <!-- Build page from here: -->
                <div class="row-fluid">

                    <div class="span12">
                        <div class="box calendar gradient">

                            <div class="title">
                                <h4>
                                    <span class="icon16 icomoon-icon-tree-view"></span>
                                    <span>Directory Category</span>
                                </h4>
                                <!-- <a href="#" class="minimize">Minimize</a> -->
                            </div>
                            <div class="content"> 
                                
                                <ul class="treeview">
                               		<li>
                               		<% 
                               		int level = 1;
                               		for (int i = 0; i < categories.size(); i++) {
                               			Category category = categories.get(i);
                               		%>
                                		<% if (level == category.getLevel()) { %>
                                			<% if (i > 0) { %>
	                                		</li>
	                                		<li>
                                			<% } %>
                                			<a href="#"><%=category.getName() %></a>
                                		<% } else if (level > category.getLevel()) {%>
                                			<% for (int j = 0; j < (level -category.getLevel()); j++) { %>
                                					</li>
                                				</ul>
                                			</li>
                                			<% } %>
                                		<li>
                                			<a href="#"><%=category.getName() %></a>
                                			
                                		<% } else { %>
                                			<ul>
                                				<li>
                                				<a href="#"><%=category.getName() %></a>
                                		<% } %>
                                		<% level = category.getLevel(); %>
                               		<% } %>
                               		</li>
                               	</ul>
                                
                            </div>

                        </div><!-- End .box -->  
                    </div><!-- End .span8 --> 


                </div><!-- End .row-fluid -->
                
<jsp:include page="/admin/layouts/footer.jsp" />